package system

import (
	"ginfast/api/system/controller"
	"ginfast/api/system/model"
	"ginfast/middleware"

	"github.com/gin-gonic/gin"
)

func Routers(r *gin.RouterGroup) {
	r.POST("/login", controller.LoginHandler)
	r.POST("/logout", controller.LogoutHandler)
	r.GET("/captcha", controller.CaptchaImageHandler)
	jwt := middleware.UseJWTAuth(r.Group(""))
	controller.Menu{}.Router(jwt.Group("/menu"))
	controller.Role{}.Router(jwt.Group("/role"))
	controller.User{}.Router(jwt.Group("/user"))
	controller.Dept{}.Router(jwt.Group("/dept"))
	controller.DictType{}.Router(jwt.Group("/dict/type"))
	controller.Dict{}.Router(jwt.Group("/dict/data"))
	controller.Post{}.Router(jwt.Group("/post"))
	controller.Config{}.Router(jwt.Group("/config"))
	controller.Notice{}.Router(jwt.Group("/notice"))
	controller.Monitor{}.Router(jwt.Group("/monitor"))
	controller.LoginLog{}.Router(jwt.Group("/loginLog"))
}

func Models() []interface{} {
	return []interface{}{
		&model.SysUser{},
		&model.SysRole{},
		&model.SysMenu{},
		&model.SysDept{},
		&model.SysDictType{},
		&model.SysDictData{},
		&model.SysPost{},
		&model.SysNotice{},
		&model.SysConfig{},
		&model.SysLoginLog{},
	}
}
